Interactive Subroutines

Interactive subroutines are subroutines activated by the user anytime during run-time by choosing the subroutine from the Interact menu. The name appearing in the Interact menu is either the subroutine name or if a string is entered as a comment statement at the beginning of the subroutine logic, the string is used as the name (e.g., # "Arrival Frequency"). Interactive subroutines allow the user to interact with the simulation during run-time. Subroutines are defined as type Interactive in the Subroutine edit table. Normally, subroutines are activated by entities. However, interactive subroutines can be user-activated in addition to being entity-activated. Interactive subroutines can be used for:

changing model parameters during a simulation run

changing routings

calculating and reporting user-defined statistics

Suppose you want to interactively change the arrival frequency for a certain entity, customers, during run time. Define a variable, Var1, and assign it an initial value to be used for the initial arrival frequency. Enter Var1 in the arrival frequency field for the entity customers. Create a subroutine of type Interactive and enter the following logic:

 

During run-time, you can then change the arrival frequency for the customers by choosing the Customer Arrivals from the Interact menu. See Run-Time Interact Menu for more information.

Please note

Interactive subroutines may also be called from any logic or expression where no return value is required. See Statements and Functions for more information.